home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #5 & #6
/
Amiga Plus CD - 1995 - No. 5 and 6.iso
/
pd
/
netz
/
term
/
extras
/
source
/
term-source.lha
/
Start.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-07-09
|
3KB
|
125 lines
/*
** Start.c
**
** The program entry point
**
** Copyright © 1990-1995 by Olaf `Olsen' Barthel
** All Rights Reserved
*/
#include <intuition/intuitionbase.h>
#include <workbench/workbench.h>
#include <exec/execbase.h>
#include <dos/dosextens.h>
#include <clib/intuition_protos.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <pragmas/intuition_pragmas.h>
#include <pragmas/exec_pragmas.h>
#include <pragmas/dos_pragmas.h>
/* Standard topaz.font/8. */
extern struct TextAttr DefaultFont;
/* exec.library base pointer. */
extern struct ExecBase *SysBase;
/* The approriate machine type check. */
#ifdef _M68030
#define MACHINE_OKAY (SysBase -> AttnFlags & AFF_68020)
#else
#define MACHINE_OKAY (1)
#endif /* _M68030 */
/* Start():
*
* Program entry point, checks for the right CPU type and
* runs the main program if possible.
*/
LONG __saveds
Start(VOID)
{
/* Get SysBase. */
SysBase = *(struct ExecBase **)4;
/* Is the minimum required processor type and Kickstart 2.04 (or higher)
* available?
*/
if(MACHINE_OKAY && (SysBase -> LibNode . lib_Version > 37 || (SysBase -> LibNode . lib_Version == 37 && SysBase -> SoftVer >= 175)))
return(main());
else
{
register struct Process *ThisProcess = (struct Process *)SysBase -> ThisTask;
/* Is a Shell window available? */
if(ThisProcess -> pr_CLI)
{
register struct DosLibrary *DOSBase;
/* Show the message. */
if(DOSBase = (struct DosLibrary *)OpenLibrary("dos.library",0))
{
if(MACHINE_OKAY)
Write(ThisProcess -> pr_COS,"Kickstart 2.04 or higher required.\a\n",36);
else
Write(ThisProcess -> pr_COS,"MC68020 or higher required.\a\n",29);
CloseLibrary(DOSBase);
}
return(RETURN_FAIL);
}
else
{
register struct IntuitionBase *IntuitionBase;
register struct WBStartup *WBenchMsg;
/* Wait for startup message. */
WaitPort(&ThisProcess -> pr_MsgPort);
/* Get the message. */
WBenchMsg = (struct WBStartup *)GetMsg(&ThisProcess -> pr_MsgPort);
/* Show the message. */
if(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0))
{
STATIC struct IntuiText SorryText = {0,1,JAM1,6,3,&DefaultFont,(UBYTE *)"Sorry",NULL};
if(MACHINE_OKAY)
{
STATIC struct IntuiText BodyText = {0,1,JAM1,5,3,&DefaultFont,(STRPTR)"Kickstart 2.04 or higher required.",NULL};
AutoRequest(NULL,&BodyText,NULL,&SorryText,NULL,NULL,309,46);
}
else
{
STATIC struct IntuiText BodyText = {0,1,JAM1,5,3,&DefaultFont,(UBYTE *)"MC68020 or higher required.",NULL};
AutoRequest(NULL,&BodyText,NULL,&SorryText,NULL,NULL,253,46);
}
CloseLibrary(IntuitionBase);
}
/* Return the startup message and exit. */
Forbid();
ReplyMsg((struct Message *)WBenchMsg);
}
}
}